<template>
  <div class="wrapper">
    <div ref="list" class="cont">
      <VirturlListTree
        :data="newList"
        node-key="key"
        :props="defaultProps"
        default-expand-all
        :height="300"
        show-checkbox
      />
    </div>
  </div>
</template>

<script>
export default {
  name: 'VirtualTree',
  props: {
    treeList: {
      type: Array,
      required: true,
      default: () => []
    },
    tabTopTypeApprove: {
      type: String,
      required: false,
      default: 'plan'
    }
  },
  data() {
    function dig(path = '0', level = 3) {
      const list = []
      for (let i = 0; i < 10; i += 1) {
        const key = `${path}-${i}`
        const treeNode = {
          title: key,
          key
        }

        if (level > 0) {
          treeNode.children = dig(key, level - 1)
        }

        list.push(treeNode)
      }
      return list
    }
    return {
      newList: dig(),
      defaultProps: {
        children: 'children',
        label: 'title'
      }
    }
  },
  computed: {},
  watch: {},
  mounted() {},
  created() {},
  methods: {}
}
</script>

<style lang="less" scoped>
.cont {
  height: 500px;
  overflow: auto;
}
</style>
